<div class="g12 nodrop" style="margin-bottom: 43px;">

    <h1> <? if (isset($article[0]['article_uptitle'])) {echo 'Ažuriranje članka'; } else echo 'Novi članak' ?> </h1>

    <p style="line-height: 13px;">

        <? if (isset($article[0]['article_title'])) {echo $article[0]['article_title']; } else echo 'Tekst, medija, rubrike, objava' ?>    

    </p>

    <ul class="breadcrumb" data-connect="breadcrumbcontent">

        <li><a href="javascript:"><span>Tekst članka</span></a></li>
        <li><a href="javascript:"><span>Media editor</span></a></li>
        <li><a href="javascript:"><span>Pregled članka</span></a></li>
        <li><a href="javascript:"><span>Rubrika i osobine</span></a></li>
        <li><a href="javascript:"><span>Datum objave</span></a></li>

    </ul>

    <div id="breadcrumbcontent">

        <!--FORM-->    
        <div style="width: 100%;">

            <h3>Tekst članka</h3>

            <div id="srvrserror-1"></div>

            <button id="dialog_confirm" style="display: none;">Confirm Dialog (confirm)</button>

            <form action="javacsipt:" method="post" autocomplete="off" data-confirm-send="false">

                <fieldset>
                    <label>Molimo uniste<a href="javascript:" style="float: right;" id="popuni">popuni formu</a></label>

                    <section><label for="input">NAD NASLOV</label>
                        <div><input type="text" id="uptitle" name="uptitle" required value="<? if (isset($article[0]['article_uptitle'])) echo $article[0]['article_uptitle']; ?>"></div>
                    </section>

                    <section><label for="input">NASLOV</label>
                        <div><input type="text" id="input" name="title" required value="<? if (isset($article[0]['article_title'])) echo $article[0]['article_title']; ?>"></div>
                    </section>

                    <section><label for="input">INTRO</label>
                        <div><input type="text" id="input" name="intro" required value="<? if (isset($article[0]['article_intro'])) echo $article[0]['article_intro']; ?>"></div>
                    </section>  

                    <section><label for="text">TEKST</label>
                        <div><textarea class="html" name="text" id="text" required><? if (isset($article[0]['article_text'])) echo $article[0]['article_text']; ?></textarea></div>
                    </section>

                    <section>
                        <div><button class="btn small reset">Obriši</button><button class="submit small icon i_arrow_right" onclick="return false;">Sačuvaj i nastavi</button></div>
                    </section> 

                </fieldset>

            </form>

        </div>

        <!--MEDIAEDITOR-->
        <div style="width: 100%; display: none;">

            <h3 style="margin-bottom: 13px;">Media galerija</h3>

            <style>
                table{
                    border-collapse: separate;
                }
                table thead tr, table tfoot tr, table th{
                    background-image: none;
                }
                table th{
                    padding: 3px 6px;
                    border-color: #F9F9F9 #D1CFCF #F9F9F9 #F9F9F9;
                    border-style: solid;
                    border-width: 1px;
                    padding-bottom: 0;
                    padding-top: 1px;
                }
                table td{
                    padding: 6px 6px;
                    border-color: #F9F9F9 #D1CFCF #F9F9F9 #F9F9F9;
                    border-style: solid;
                    border-width: 1px;
                }
                .grid {
                    border-bottom: 0 none;
                    padding-bottom: 0.5em;
                }
                .grid table.border {
                    border: 1px solid #CBD3D4;
                }
                .grid table {
                    -moz-border-bottom-colors: none;
                    -moz-border-image: none;
                    -moz-border-left-colors: none;
                    -moz-border-right-colors: none;
                    -moz-border-top-colors: none;
                    border-color: #CBD3D4 #CBD3D4 -moz-use-text-color;
                    border-style: solid solid none;
                    border-width: 1px 1px medium;
                    width: 100%;
                }
                form input, form textarea {
                    font-size: 13px;
                    padding: 3px 2px;
                }
                table td, table td.naziv{
                    text-align: left; vertical-align: middle; line-height: 11px; padding: 3px 3px;
                }
                table td, table td.autor{
                    text-align: left; vertical-align: middle;
                }
                table td, table td.akcija{
                    vertical-align: middle;
                }
            </style>

            <div id="dialog" style="display: none; position: relative;">

                <div style="position: absolute; right: -13px; top: -11px; z-index: 5;"><a href="javascript:" id="closeDialog"><img src="<?=$url?>assets/img/backgnds/x.png" /></a></div>

                <div class="ex_highlight_row">

                    <table class="datatable" cellpadding="0" cellspacing="0" id="example">

                        <thead>                      
                            <tr>
                                <th>Naziv</th><th>Slika</th><th>Autor</th><th>Kreirana</th><th>AÅ¾urirana</th><th>Tagovi</th><th>Akcija</th> 
                            </tr>
                        </thead>

                        <tbody>

                            <?
                                foreach($media as $row){?>

                                <tr>
                                    <td class="naziv"><?=$row['name']?></td>
                                    <td align="left" height="23">
                                        <div style="line-height: 0; font-size: 0">
                                            <img src="<?=$url.'tempatt/'.$row['file']?>" height="23" />
                                        </div>
                                    </td>
                                    <td class="autor"><?=$row['author']?></td>
                                    <td class="autor"><?= date('d.m.Y H:i',$row['created']);?> h</td>
                                    <td class="autor"><? if($row['modified']!=null) echo date('d.m.Y H:i',$row['modified']).' h';?> </td>
                                    <td class="autor"><?=$row['tags']?></td>

                                    <td class="akcija">
                                        <a href="<?=$url?>media/mediapreview?id=<?=$row['id']?>" class="small" id="<?=$row['id']?>">Pogledaj</a> |
                                        <a href="<?=$url?>media/editform?id=<?=$row['id']?>" class="small" id="<?=$row['id']?>">Uredi</a> |
                                        <a href="javascript:" class="deletemedia small" id="<?=$row['id']?>">ObriÅ¡i</a>
                                    </td> 
                                </tr>    

                                <?}

                            ?>

                        </tbody>

                    </table>

                    <table class="datatable" cellpadding="0" cellspacing="0" id="example">

                        <thead>                      
                            <tr>
                                <th>Naziv</th><th>Slika</th><th>Autor</th><th>Kreirana</th><th>Ažurirana</th><th>Tagovi</th><th>Akcija</th> 
                            </tr>
                        </thead>

                        <tbody>

                            <?
                                foreach($media as $row){?>

                                <tr>
                                    <td style="text-align: left; vertical-align: middle; line-height: 11px; padding: 3px 3px;"><?=$row['name']?></td>
                                    <td align="left" height="23" style="vertical-align:top">
                                        <div style="line-height: 0; font-size: 0">
                                            <img src="<?=$url.'tempatt/'.$row['file']?>" height="23" />
                                        </div>
                                    </td>
                                    <td style="text-align: left; vertical-align: middle;"><?=$row['author']?></td>
                                    <td style="text-align: left; vertical-align: middle;"><?= date('d.m.Y H:i',$row['created']);?> h</td>
                                    <td style="text-align: left; vertical-align: middle;"><? if($row['modified']!=null) echo date('d.m.Y H:i',$row['modified']).' h';?> </td>
                                    <td style="text-align: left; vertical-align: middle;"><?=$row['tags']?></td>

                                    <td style="vertical-align: middle;">
                                        <a href="javascript:" class="small chooseImage" id="<?=$row['id']?>" key="<?=$row['file']?>">Odaberi</a>
                                    </td> 
                                </tr>    

                                <?}

                            ?>

                        </tbody>

                    </table>

                </div>


            </div>

            <div id="srvrserror-2" style="display: none;"></div>

            <div class="grid" style="width: 100%;">

                <form action="javacsipt:" method="post" name="mediaGallery" id="mediaGallery"> 

                    <table width="100%" cellspacing="0" cellspacing="0" id="media_gallery_content_grid" class="data border">

                        <thead>
                            <tr style="background-image: url(<?=$url?>assets/img/sort_row_bg.gif); background-repeat: repeat-x; background-position: 0 50% ;">
                                <th>Slika</th>
                                <th>Natpis</th>
                                <th>Sortiranje</th>
                                <th>Lijevo <br>[PRIKAZ SLIKE]</th>
                                <th>Sredina <br>[PRIKAZ SLIKE]</th>
                                <th>Desno <br>[PRIKAZ SLIKE]</th>
                                <th>Dodaj</th>
                                <th style="border-width: 0;">Ukloni</th>
                            </tr>    
                        </thead>

                        <tbody>

                            <input type="hidden" name="artId" id="artId" value="162" />

                            <? 
                                $i=0;
                                for ($i=$i; $i<5; $i++){?>
                                <tr id="mg-img-<?=$i?>">
                                    <td class="imgHolder-<?=$i?>" style="vertical-align: middle;">No image</td>                                       
                                    <input type="hidden" name="img[]" id="img-<?=$i?>" value="" class="emptyChecker" />
                                    <td><input type="text" name="caption[]" id="caption-<?=$i?>" style="width: 190px;" /></td>
                                    <td><input type="text" name="sort[]" id="sort-<?=$i?>" style="width: 80px;" value="<?=$i+1?>" /></td>
                                    <td style="text-align: center;"><input type="radio" name="img_pos[]<?=$i?>" value="left"></td>
                                    <td style="text-align: center;"><input type="radio" name="img_pos[]<?=$i?>" checked="checked" value="center"></td>
                                    <td style="text-align: center;"><input type="radio" name="img_pos[]<?=$i?>" value="right"></td>
                                    <td><a href="javascript:" id="<?=$i?>" class="addImage"> Dodaj sliku</a></td>
                                    <td style="border-width: 0;"><a href="javascript:" class="ukloniRed">Ukloni red</a></td>
                                </tr>
                                <?}?>
                        </tbody>
                    </table>

                </form>

                <div>
                    <a href="javascript:" id="dodajRed">Dodaj red</a>
                </div>
            </div>

            <hr>

            <button id="prev_1" class="small prev icon i_arrow_left">Povratak</button><button id="next_2" class="small icon i_arrow_right">Sačuvaj i nastavi</button> 


        </div>

        <!--PREVIEW-->
        <div style="width: 100%; display: none;">

            <?

                $uptitle = 'NADNASLOV';
                $title = 'NASLOV';
                $intro = 'INTRO';
                $text = 'ČLANAK';
                $media_img = NULL;
                $art_column_id = NULL;
                $art_subcolumn_id = NULL;

                if(isset($article[0])){
                    $uptitle = $article[0]['article_uptitle']; 
                    $title = $article[0]['article_title']; 
                    $intro = $article[0]['article_intro']; 
                    $text = $article[0]['article_text'];
                    $media_img = $url.'tempatt/'. $article[0]['media_filepath']; 
                    $art_column_id = $article[0]['article_column_id']; 
                    $art_subcolumn_id = $article[0]['article_subcolumn_id'];
                }

            ?>

            <h3>Pregled članka</h3>

            <div class="preview" style="min-height: 357px;">

                <div class="art_intro">

                    <div class="text">

                        <h2><?=$uptitle?></h2>

                        <h1><?=$title?></h1>

                        <div class="img">
                            <?
                                if(isset($media_img)) {
                                ?>
                                <img src="<?=$media_img?>" />
                                <?
                                }
                            ?>   
                        </div>

                        <p><?=$intro?></p>

                    </div>

                </div>

                <div class="art_cont" style="margin-bottom: 43px;">

                    <div class="column">

                        <?=$text?>

                    </div>

                </div>

                <div class="social_widget" style="">

                    <a href="mailto:?subject=Dan online članak&amp;body=Pozdrav! Mislim da će te članak <?=$url?> zanimati.%0A%0ADan online%0Ahttp://www.dan.me/" class="mail">Pošalji prijatelju</a>

                </div>
                <div style="clear: both;"></div>

                <button id="prev_2" class="small prev icon i_arrow_left">Povratak</button><button id="conf_preview" class="small next icon i_arrow_right">Nastavi na rubrike i podešavanja</button>


            </div>

            <div style="clear: both;"></div>

        </div>

        <!--COLUMNS & TAGS-->
        <div style="width: 100%; display: none;">

            <h3 style="margin-bottom: 3px;">Rubrika članka</h3>

            <div id="srvrserror-3"></div>

            <div class="accordion_tmp" id="columns">

                <select name="column" id="column" style="color: #555555; line-height: 16px; padding: 3px 0 0 3px; width: 17em;">
                    <option value="0">-- Molim odaberite</option>
                    <?
                        foreach($columns as $column){

                            if($column['name']!="tmp"){

                                echo '<optgroup label="'.$column["name"].'">';

                                foreach($subcolumns as $subcolumn){

                                    if($subcolumn['column_id']==$column['id']){
                                    ?><option value="<?=$subcolumn['id'];?>" <? if(($subcolumn['column_id']==$art_column_id)&&($subcolumn['id']==$art_subcolumn_id)){ echo 'selected=selected';} ?>><?=$subcolumn['name'];?></option><?

                                    }

                                }

                            }
                        }
                    ?>
                </select>

            </div> 

            <h3 style="margin-top: 20px;margin-bottom: 3px;">Osobine članka</h3>                               

            <select id="tagovi" name="tagovi[]" multiple="multiple" title="-- Molimo odaberite" style="color: #555555; line-height: 16px; padding: 3px 0 0 3px;">
                <?
                    $selected_tag = '';
                    foreach($tags as $tag){

                        foreach($articletags as $articletag){  

                            if($articletag['tag_id']==$tag['id']){
                                $selected_tag = 'selected="selected"';    
                            }

                        }

                    ?><option value="<?=$tag['id'];?>" <?=$selected_tag?>><?=$tag['title'];?></option><? 
                        $selected_tag = ''; 
                    }
                ?>
            </select>

            <hr>

            <button id="prev_3" class="small prev icon i_arrow_left">Povratak</button><button id="conf_category_tags" class="small icon i_arrow_right">Nastavi</button>



        </div>

        <!--PUBLISH-->
        <div style="width: 100%; display: none;">

            <h3>Datum i vrijeme objave</h3>

            <div id="cal">

                <div class="boxdatum">

                    <table style="width: 450px;">
                        <tr>
                            <td style="width: 17em;">

                                <h6 style="margin-top: 23px;"><strong>POLUOBJAVA</strong></h6>

                                <div id="datumkomponenta1">

                                    <div class="gifloader"></div>

                                </div>

                                <?
                                    $datepublishhalf = '18:00';
                                    if (isset($article[0]['article_datepublishhalf'])){
                                        $datepublishhalf =   mdate("%H:%i", $article[0]['article_datepublishhalf']);   
                                        // echo $datepublish;
                                    }

                                ?>
                                <input type="text" id="time1" value="<?=$datepublishhalf;?>" class="time1" style="margin-top: 3px; text-align: center; width: 43px;"> 
                            </td>
                            <td style="width: 17em;  padding-left: 13px">

                                <h6 style="margin-top: 23px;"><strong>OBJAVA</strong></h6>

                                <div id="datumkomponenta2">

                                    <div class="gifloader"></div>

                                </div>

                                <?
                                    $datepublish = '18:00';
                                    if (isset($article[0]['article_datepublish'])){
                                        $datepublish =   mdate("%H:%i", $article[0]['article_datepublish']);   
                                        // echo $datepublish;
                                    }

                                ?>
                                <input type="text" id="time2" value="<?=$datepublish;?>" class="time2" style="margin-top: 3px; text-align: center; width: 43px;">
                            </td>
                            <td style="width: 17em;  padding-left: 13px">

                                <h6 style="margin-top: 23px;"><strong>TRAJE DO</strong></h6>

                                <div id="datumkomponenta3">

                                    <div class="gifloader"></div>

                                </div>

                                <?
                                    $datepublishend = '18:00';
                                    if (isset($article[0]['article_datepublishend'])){
                                        $datepublishend =   mdate("%H:%i", $article[0]['article_datepublishend']);   
                                        // echo $datepublish;
                                    }

                                ?>
                                <input type="text" id="time3" value="<?=$datepublishend;?>" class="time3" style="margin-top: 3px; text-align: center; width: 43px;">
                            </td>
                        </tr>
                    </table>





                </div>

            </div> 

            <div id="srvrserror-4"></div>

            <!--<a href="javascript:" class="gDate">gDate</a>-->

            <hr>

            <button id="prev_4" class="small prev icon i_arrow_left">Povratak</button>
            <button id="finish" class="small icon i_breadcrumb">Završi unos</button>  


        </div>

    </div>

</div>

<!-- VARIABLES TO edit_new.js -->
<script type="text/javascript">
    var appmode;
    var publishmode;
    var artId;
    var rowCount;  
    <?  if (isset($article[0]['article_datepublish'])){ ?> 
        publishdatetimehalf = '<? echo $article[0]['article_datepublishhalf']?>'; 
        publishdatetime = '<? echo $article[0]['article_datepublish']?>'; 
        publishdatetimeend = '<? echo $article[0]['article_datepublishend']?>'; 
        artId = '<? echo $article[0]['article_id']?>'
        appmode = 'edit';
        publishmode = 'edit';
        rowCount = '<? echo $i?>';

        <?}else{?> 
        appmode = 'insert'; 
        publishmode = 'insert' 
        artId = -1;
        rowCount = '<? echo $i?>';
        <? } ?>
</script>